package earley;

import java.util.List;

public class Rule {
	final Symbol left;
	final List<Symbol> right;
	public Rule(Symbol left, List<Symbol> right) {
		this.left = left;
		this.right = right;
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder("<" + left + "> ::= ");
		for (Symbol s : right) {
			//System.out.println("SYMBOL: " + s.name + " " + s.isTerminal);
			if (s.isTerminal) {
				sb.append(" " + s.name);
			} else {
				sb.append(" <" + s.name + ">");
			}
		}
		return sb.toString();
	}
}
